<template>
  <div class="page">
    <el-card>
      <template #header>
        <div class="card-header">
          <text>店铺名称</text>
          <div>桌台A107</div>
        </div>
      </template>
      <div class="card-content">
        <div class="item" v-for="im in 15" :key="im">
          <div>
            <div>菜品名称</div>
            <div>x 1</div>
          </div>
          <text>￥25.00</text>
        </div>
        <div class="subtotal">
          <text>小计</text>
          <text>￥25.00</text>
        </div>
      </div>
    </el-card>
    <div class="interval" />
    <div class="pay">
      <div class="btn">
        <text>支付</text>
        <text>23.90</text>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { useRoute } from "vue-router";

const route = useRoute();
const payType = ref("");

const isPayType = () => {
  let userAgent = window.navigator.userAgent.toLowerCase();
  if (userAgent.match(/Alipay/i) == "alipay") {
    alert("支付宝浏览器");
    console.log("alipay");
    payType.value = "alipay";
  } else if (userAgent.match(/MicroMessenger/i) == "micromessenger") {
    alert("微信浏览器");
    console.log("weChat");
    payType.value = "weChat";
  }
};
onMounted(() => {
  isPayType();
  console.log("route", route.query, payType);
});
</script>

<style>
body {
  background-color: rgb(237 237 237 / 100%);
}
</style>
<style lang="scss" scoped>
.page {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 10px;
  .card-header {
    display: flex;
    justify-content: space-between;
  }
  .card-content {
    .item {
      display: flex;
      justify-content: space-between;
      margin-bottom: 20px;
    }
    .subtotal {
      display: flex;
      justify-content: space-between;
      padding-top: 20px;
      border-top: 1px var(--el-card-border-color) solid;
    }
  }
  .interval {
    height: 75px;
  }
  .pay {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 20px 30px;
    color: #ffffff;
    text-align: center;
    background-color: #f76260;
  }
}
</style>
